package com.hex.ds.hdtp.core.app.script.test.converter;

import com.hex.ds.hdtp.core.app.common.enums.BasicListStatus;
import com.hex.ds.hdtp.core.app.script.test.dto.request.ScriptDataTestResultRequestDto;
import com.hex.ds.hdtp.core.app.script.test.dto.response.ScriptDataTestListResponseDto;
import com.hex.ds.hdtp.core.app.script.test.dto.response.ScriptDataTestResultResponseDto;
import com.hex.ds.hdtp.core.inf.script.test.po.ScriptDataTestResultPo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * @Package: com.hex.ds.hdtp.core.app.script.test.converter
 * @ClassName IScriptDataTestResultConverter
 * @Description: 带数据测试结果-DTO对象转PO对象转换器
 * @Author: wz.li
 * @Date 2023/8/7 12:00
 * @Version v2.0.2
 **/
@Mapper(componentModel = "spring", imports = {BasicListStatus.class})
public interface IScriptDataTestResultConverter {

    ScriptDataTestResultPo toScriptDataTestResultPo(ScriptDataTestResultRequestDto scriptDataTestResultRequestDto);

    List<ScriptDataTestResultResponseDto> toScriptDataTestResultResponseDtoList(List<ScriptDataTestResultPo> scriptDataTestResultPos);

    ScriptDataTestResultRequestDto toScriptDataTestResultRequestDto(ScriptDataTestResultResponseDto scriptDataTestResultResponseDto);

    @Mapping(target = "pkId", ignore = true)
    @Mapping(target = "scriptTestListPkId", source = "scriptDataTestListResponseDto.pkId")
    @Mapping(target = "batchCode", source = "batchCode")
    @Mapping(target = "bizDate", source = "bizDate")
    @Mapping(target = "scriptPath", source = "scriptPath")
    @Mapping(target = "status", expression = "java(BasicListStatus.TODO.name())")
    ScriptDataTestResultRequestDto toScriptDataTestResultRequestDto(
            ScriptDataTestListResponseDto scriptDataTestListResponseDto,
            String batchCode,
            String bizDate,
            String scriptPath);
}
